#ifndef INC_TOOL_H
#define INC_TOOL_H

#include "../base/MouseListener.h"
#include "DiagramFam.h"
#include "DiagramMan.h"

// abstract 
class Tool : public MouseListener
{
	public:
		Tool(DiagramMan&);

	protected:
		DiagramMan& dman() const;

		/**
		 * Convenience function to translate given point to logical coordinates.
		 * Equivalent to:
		 *
		 * dman().active().canvas().trans().tological(pt)
		 */
		QPoint tological(const QPoint& pt);

	private:
		DiagramMan& _dman;
};

inline QPoint Tool::tological(const QPoint& pt)
{
	return dman().active().canvas().trans().tological(pt);
}

#endif // INC_TOOL_H

